package com.zzw.controller;

import com.sun.org.apache.xpath.internal.operations.Or;
import com.zzw.entity.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/member/consumer")
public class MemberConsumerController {

    //服务提供者
    private static final String MEMBER_MEMBER_PROVIDER_URL = "http://localhost:10001/member/provider/selectById/";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/selectById/{id}")
    public Result selectById(@PathVariable("id") Integer id){
        String result = restTemplate.getForObject("http://localhost:10001/member/provider/selectById/{id}",  String.class, id);
        return Result.success(result);
    }
}
